> more assault.c
/*
***** Version History *****
* 971014 Hellbent recoded this totally from scratch.
* 971124 Hellbent fixed a but that was tossing an error in the
* help function.
* 04 Mar 00 Hawk capped the duratoin of ko at 24 seconds and changed
the calc for chance
* 24 Mar 00 Hawk - lowered bonus from 600 to 520 and changed gp calc from
special / 10
* to unarmed / 15
*/
#include
inherit CMD_BASE;
inherit "/cmds/guild/attack_cmd.c";
#include "/cmds/guild/budoka/extra/assault.h" /* class definitions. */
#define HIDE_BONUS 100
#define MIN_LEVEL 25
#define MIN_BONUS 50
#define MAX_BONUS 520
#define TYPE "assault_type"
#define FCMU "fighting.combat.melee.unarmed"
#define TO_HIT_BONUS 0
#define TO_HIT_MINUS 12
#define DAMAGE_BONUS 40
#define SHADOW "/cmds/guild/common/shadows/ko_shad.c"
int query_valid_use( object ob )
{
if( !ob->query_property( "com_list" ) || ob->query_property( "com_list"
)["second"]
!= "assault" ) return 0;
return 1;
}
int help( object me )
{
string tmp_str, skill_str;
int skill, i, max, offs;
if( !me->query_property_exists( TYPE ) )
me->add_property( TYPE, ({ 0, 0, 0, 0 }) );
tmp_str = "\n\n"
"Skill: Assault\n"
"Usage: assault with combos\n"
" -or- assault with dim mak\n"
"Cost : "+query_gp_cost( me )+"\n"
"Minimum Level: "+MIN_LEVEL+" in "+FCMU+"\n"
"Current Rating: "+querySDString( query_perc_mult
( me, 0 ), MAX_BONUS - 100 )+"\n"
"Description\n"
" These are techniques to let you use both weapons and your\n"
" natural weapons, such as hands, feet, and head in a real fight.\n"
" From now on, you will never be without a weapon or defenseless.\n"
" You will gain combos through practicing\n"
"\t fighting.combat.melee.unarmed, which will also determine how
effective\n"
"\t you will be.\n";
skill = me->query_skill( FCMU );
if ( skill < 25 )
{
tmp_str += "\nYou don't know any techniques yet.\n";
skill_str = "";
}
if ( skill >= 25 )
{
skill_str = "";
tmp_str += "\n"
"Combos --- These are deadly combinations of punches and\n"
" kicks which are quite effective.\n";
max = combos->max_known;
offs = ( skill - 24 ) / 30 + 1;
if( offs > max ) offs = max;
for( i = 0; i < offs; i++ )
{
skill_str += combos->names[i];
skill_str += "\n";
}
}
if ( skill >= 400 )
{
tmp_str += "\n"
"Dim Mak -- This is the famous death-touch, a palm-heel\n"
" strike to the heart region of the target. \n"
" It does not do much damage, but it disrupts\n"
" the enemy's chi, leading to decreased health\n"
" and mobility.\n";
}
tell_object( me, tmp_str + "\nPunches and Kicks:\n\n"+
sprintf( "%*#-s\n\n",
me->query_cols(), skill_str ) );
return 1;
}
void create()
{
::create();
set_cmd_name( "assault" );
set_delay(2);
set_num_att(2);
set_max_weapons(0);
set_hide_bonus( HIDE_BONUS );
guildonly( "budoka" );
set_range( MIN_BONUS, MAX_BONUS );
set_use_hands(1);
//code for this contained inside of assault.h - HB
setup_classes();
set_fail_mess( ({
"You're already $cmd$ing someone!",
"You can't seem to find your target.",
"Trying to assault a $targ$ will get you nowhere,"
" and you would look silly anyway.",
"How do you expect to assault $targ$?",
"You are too fatigued to channel your chi.",
"You are not trained in the ways of the Ninjas, and"
" thus cannot assault anyone.",
"You are not skilled enough in Ninjitsu to assault!" }) );
set_prep_mess( ({ "You prepare to $cmd$ $targ$." }) );
set_att_mess( ({
"You $cmd$ $targ$.",
"$me$ $cmd$s you.",
"$me$ $cmd$s $targ$." }) );
}
protected int cmd( class command cmd )
{
string type, target, msg, *amsg;
int div, count, rand, attacks, set1 = 0, set2 = 0, offs;
if( !query_valid_use( cmd->user ) ) return 0;
if( cmd->arg == "help" ) return help( cmd->user );
if( !cmd->arg || sscanf( cmd->arg, "%s with %s", target, type ) != 2 )
{
tell_object( cmd->user, "Usage: assault "
" with .\n" );
return 1;
}
switch( type )
{
case "combos":
set_allowed_weapon_type( FCMU );
set_num_att( 2 );
div = 30;
//Tweak this later? Right now, you get all 9 attacks
//when you have an unarmed of 675 - HB
//HB answers himself and says: Leave it, makes even
//more sense to go all unarmed this way.
attacks = ( ( cmd->user->
query_skill( FCMU ) - 24 ) / 75 + 1 );
if( attacks > 9 ) attacks = 9;
msg = "\nWith control worthy of a master, you launch ";
count = combos->max_known;
rand = ( cmd->user->
query_skill_bonus( FCMU ) - 24 ) / div + 1;
if( rand > count ) rand = count;
for( count = 0; count < attacks; count++ )
{
//should be okay here - HB
offs = random( rand - ( rand / 2 ) ) + ( rand / 3 );
msg += combos->names[offs];
if( count == attacks - 2 ) msg += " and ";
else if( count < attacks - 2 ) msg += ", ";
else msg += " at $targ$.";
set1 += combos->hit_bonus[offs];
set2 += combos->attack_bonus[offs];
}
amsg = ({ msg });
amsg += ({ "$me$ launches with lightning speed "+
combos->names[offs] });
amsg += ({ amsg[1]+" at $targ$." });
amsg[1] += " at you.";
set_att_mess( amsg );
break;
case "dim mak":
set_allowed_weapon_type( FCMU );
set_num_att(1);
attacks = 1;
msg = "\nWith control worthy of a master, you launch ";
count = dim_mak->max_known - 1;
msg += dim_mak->names[count] +" at $targ$.";
set1 = dim_mak->hit_bonus[count];
set2 = dim_mak->attack_bonus[count];
amsg = ({ msg });
amsg += ({ "$me$ launches with lightning speed "+
dim_mak->names[count]+" kata" });
amsg += ({ amsg[1]+" at $targ$." });
amsg[1] += " at you.";
set_att_mess( amsg );
break;
default:
tell_object( cmd->user, "You don't know any "+
type+" techniques.\n" );
return 1;
break;
}
if( interactive( cmd->user ) )
{
cmd->arg = cmd->user->expand_nickname( cmd->arg );
}
//Is there a better way? - HB
//Probably not, since global variables caused this
//whole mess - HB answers himself.
cmd->user->add_property( TYPE,
({ type, set1, set2, attacks }) );
::do_attack( cmd->user, target );
return 1;
}
int query_level_ok( object me )
{
//still relying on property here. Bonus to this method
/cmds/guild/budoka/assault.c From 193 to 217 of 310 (70%) - q to quit.
//is that we're avoiding global variables entirely - HB
switch( me->query_property( TYPE )[0] )
{
case "combos":
return me->query_skill( FCMU ) >= combos->learn_level;
case "dim mak" case "dim mak":
return me->query_skill( FCMU ) >= dim_mak->learn_level;
default:
return 0;
}
}
int query_gp_cost( object me )
{
if( me->query_property( TYPE )[0] == "dim mak" )
{
return( me->query_max_gp() / 4 );
}
return( me->query_skill_bonus( FCMU ) / 15 );
}
int query_perc_mult( object me, object weapon )
{
return (me->query_skill_bonus( FCMU )/3) + 100;
}
int attack2( mixed *args )
{
int damage;
string type;
object me, target;
me = args[0];
target = args[2];
type = me->query_property( TYPE )[0];
if( !me )
return 0;
damage = ::attack2( args );
if( damage != 0 && type == "dim mak" )
{
//Made sure that target has to be over 6 in con/dex
//for it to affect them - HB 971016
tell_object( target, "Your nerves feel like they are burning,"
" and when the pain subsides you feel weaker.\n" );
tell_object( me, "You successfully launch a Dim Mak"
" strike at your opponent!\n" );
if( target->query_con() > 5 )
target->adjust_tmp_con( -1 * ( random(
me->query_skill_bonus( FCMU ) / 300 ) + 1 ) );
if( target->query_dex() > 5 )
target->adjust_tmp_dex( -1 * ( random(
me->query_skill_bonus( FCMU ) / 300 ) + 1 ) );
}
/* Here's the new and improved, VERY rare KO bit - HB */
if( type == "combos" && damage &&
random( 100 ) <= me->query_skill_bonus( FCMU ) / 215 )
//always a 1% chance/max of ~9% chance. - HB
{
if( !target->query_property_exists( "passed out" ) )
{
int time;
// Hawk - changed to max duration of 20 seconds with random factor
time = me->query_skill_bonus( FCMU ) / 80;
if( time > 20 ) time = 20;
if( userp( target ) ) time /= 2; //half time for PCs.
time = random( time - 1 ) + 3;
new( SHADOW )->start_shadow( me, target, time );
//tell target/me that they got passed out. - HB
pretty_tell_object( me, "\nWith a skillfully placed "+
combos->skill_str +" you hammer $targ$ into the"
" blackness of unconsciousness.", me, target );
pretty_tell_object( target, "$me$ moves with the speed of"
" lightning and hits you with several powerful attacks. "
" The world starts spinning before your eyes, and soon"
" you are plunging towards the merciful blackness of"
" unconsciousness.", me, target );
pretty_tell_room( environment( target ), "$targ$ falls to the"
" ground unconscious after being hit by several heavy"
" blows from $me$.", ({ me, target }), me, target );
}
}
/* end of KO mods - HB */
return damage;
}
void dest_me() {
cmd::dest_me();
}